package com.shop.admin.controller;

import com.shop.entity.dto.AdminCost.*;
import com.shop.entity.pojo.Cost;
import com.shop.admin.service.CostService;
import com.shop.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/cost")
public class AdminCostController {

    @Autowired
    private CostService costService;

    @PostMapping("save_cost")
    public Result saveOneCost(@RequestBody AdminCostSaveDto dto){
        return costService.saveOneCost(dto);
    }

    @PostMapping("update_get_cost")
    public Result<Cost> updateGetCost(@RequestBody AdminCostUpdateForGetDto dto){
        return costService.updateGetCost(dto);
    }

    @PostMapping("update_cost")
    public Result updateCost(@RequestBody AdminCostUpdateDto dto){
        return costService.updateCost(dto);
    }

    @PostMapping("remove_cost")
    public Result removeCost(@RequestBody AdminCostRemoveDto dto){
        return costService.removeCost(dto);
    }

    @PostMapping("/get_cost_list")
    public Result getCostList(@RequestBody AdminCostListDto dto){
        return costService.getCostList(dto);
    }

    @PostMapping("open_cost")
    public Result openCost(@RequestBody AdminCostOpenDto dto){
        return costService.openCost(dto);
    }

    @PostMapping("pull_cost")
    public Result pullCost(@RequestBody AdminCostPullDto dto){
        return costService.pullCost(dto);
    }

    @PostMapping("put_cost")
    public Result putCost(@RequestBody AdminCostPutDto dto){
        return costService.putCost(dto);
    }

}
